import Vue from 'vue'
import App from './App.vue'
import router from './router'
import "lib-flexible/flexible"
import { Tabbar, TabbarItem } from 'vant';
import { ShareSheet } from 'vant';
import VueClipboard from 'vue-clipboard2'
import { Toast } from 'vant';
import { Popup } from 'vant';
import { Search } from 'vant';
import { Swipe, SwipeItem } from 'vant';
import axios from 'axios'
import VueAxios from 'vue-axios'
import VueCookies from 'vue-cookies'
import { NavBar } from 'vant';
import { Tab, Tabs } from 'vant';
import { Empty } from 'vant';
import { Icon } from 'vant';
import { Form } from 'vant';
import { Field } from 'vant';
import { Button } from 'vant';
import { Stepper } from 'vant';
import { GoodsAction, GoodsActionIcon, GoodsActionButton } from 'vant';
import { SubmitBar } from 'vant';
import { Checkbox, CheckboxGroup } from 'vant';
import { SwipeCell } from 'vant';
import { Uploader } from 'vant';
import { Area } from 'vant';
import { Tag } from 'vant';
import { AddressEdit } from 'vant';
import { AddressList } from 'vant';
import { Dialog } from 'vant';
import { Image as VanImage } from 'vant';
import { Cell, CellGroup } from 'vant';
import { RadioGroup, Radio } from 'vant';

Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(Cell);
Vue.use(CellGroup);
Vue.use(VanImage);
// 全局注册
Vue.use(Dialog);
Vue.use(AddressList);
Vue.use(AddressEdit);
Vue.use(Tag);
Vue.use(Area);
Vue.use(Uploader);
Vue.use(SwipeCell);
Vue.use(Checkbox);
Vue.use(CheckboxGroup);
Vue.use(SubmitBar);
Vue.use(GoodsAction);
Vue.use(GoodsActionButton);
Vue.use(GoodsActionIcon);
Vue.use(Stepper);
Vue.use(Button);
Vue.use(Form);
Vue.use(Field);
Vue.use(Icon);
Vue.use(Empty);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(NavBar);
Vue.use(VueCookies)
Vue.use(VueAxios, axios)
Vue.use(Swipe);
Vue.use(SwipeItem);
Vue.use(Search);
Vue.use(Popup);
Vue.use(Toast);
Vue.use(VueClipboard);
Vue.use(ShareSheet);
Vue.use(Tabbar);
Vue.use(TabbarItem);



// 添加请求拦截器
axios.interceptors.request.use((config) => {
    // 在发送请求之前做些什么
    Toast.loading({
        message: "加载中..",
        forbidClick: true,
    })
    return config;
}, (error) => {
    Toast.clear()
        // 对请求错误做些什么
    return Promise.reject(error);
});

// 添加响应拦截器
axios.interceptors.response.use((response) => {
    // 对响应数据做点什么
    Toast.clear()
        // console.log("服务器返回的数据==>", response);
    return response
}, (error) => {
    Toast.clear()
        // 对响应错误做点什么
    return Promise.reject(error);
});





axios.defaults.baseURL = "http://www.kangliuyong.com:10002"
Vue.config.productionTip = false

new Vue({
    router,
    render: h => h(App)
}).$mount('#app')